package DesignMode.flyweight;

import java.util.HashMap;

/**
 * @author : zhouliangliang5
 * @date : 2023/2/17 10:05
 * @description :
 */
public class GobangFactory {
    private static final HashMap<String, Gobang> map = new HashMap<>();

    public static Gobang getGobang(String color) {
        Gobang gobang = map.get(color);
        if(gobang == null) {
            gobang = new Gobang(color);
            map.put(color, gobang);
            System.out.println("Create Gobang of Color : " + color);
        }
        return gobang;
    }
}
